package one.stand.enums;

/**
 * 优惠类型
 * @author luoyang
 * @date 2020/4/29 15:36
 */
public enum GrantModelEnums {
    // 发放类型/方式，1：自动发放，2手动领取，3红包发放
//    发放类型，0新用户赠劵 1首页赠劵
    NEW_USER(0,"新用户赠劵"),HOME(1,"首页赠劵");

    private Integer code;

    private String name;

    GrantModelEnums(Integer code, String name) {
        this.code = code;
        this.name = name;
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    // 普通方法
    public static String getName(int code) {
        for (GrantModelEnums c : GrantModelEnums.values()) {
            if (c.getCode() == code) {
                return c.name;
            }
        }
        return null;
    }
}
